<?php

namespace app\model;


class LawUserModel extends ActionBaseModel
{
    protected $name = 'law_user';

    // 账号状态
    const STATUS_NORMAL = 0; //账号正常
    const STATUS_FORBIDDEN = 1; //账号被封禁
    const STATUS_OFF = 2; //账号已注销

    // 用户权限
    const ROLE_REGIST_NO = 10;//未注册
    const ROLE_REGIST_YES = 20;//已注册
    const ROLE_LAWYER = 30;//律师
    const ROLE_SUPER_ADMIN = 40;//超级管理员

    static public function getStatusText(int $intStatus): string
    {
        switch ($intStatus) {
            case self::STATUS_NORMAL:
                return '正常';
            case self::STATUS_FORBIDDEN:
                return '被封禁';
            case self::STATUS_OFF:
                return '已注销';
            default:
                return '未知';
        }
    }

    public function addUser(array $arrData): bool
    {
        if (empty($arrData)) {
            return false;
        }
        $modelLawUser = new self();
        $intLow = $modelLawUser->insert($arrData);
        if (empty($intLow)) {
            return false;
        }
        return true;
    }
}
